/*
 * body_visualizer.c
 * This file is part of gURL
 *
 * Copyright (C) 2014 - Aleksey Konovalov
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU Library General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU Library General Public License for more details.
 *
 *  You should have received a copy of the GNU Library General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 */

#include "body_visualizer.h"

#include "defines.h"

G_DEFINE_INTERFACE(BodyVisualizer, body_visualizer, 0)

static void pure_virtual_call() {
    g_critical("pure virtual function call");
    g_assert_not_reached();
}

static gboolean body_visualizer_default_check_is_compatible(
    BodyVisualizer* UNUSED(self), Session* UNUSED(session)) {
    return TRUE;
}

static void body_visualizer_default_init(BodyVisualizerInterface* self) {
    self->change_session = pure_virtual_call;
    self->check_is_compatible = body_visualizer_default_check_is_compatible;
}

void body_visualizer_change_session(BodyVisualizer* self, Session* session) {
    BODY_VISUALIZER_GET_INTERFACE(self)->change_session(self, session);
}

const char* body_visualizer_get_name(const BodyVisualizer* self) {
    return BODY_VISUALIZER_GET_INTERFACE(self)->name;
}

gboolean body_visualizer_check_is_compatible(BodyVisualizer* self,
                                             Session* session) {
    return BODY_VISUALIZER_GET_INTERFACE(self)->check_is_compatible(self, session);
}
